var app = getApp()
Page({
  data: {
    info: {}
  },
  onLoad: function (options) {
    this.loadDetail(options.id)
  },
  callPhone(e) {
    var phone = e.currentTarget.dataset.phone
    wx.makePhoneCall({
      phoneNumber: phone,
      success: () => {
      }
    })
  },
  viewRoom() {
    var pages = getCurrentPages();
    var prevPage = pages[pages.length - 2];  //上一个页面
    prevPage.gotoDataRoom()
    wx.navigateBack({
      delta: 1
    })
  },
  back(){
    wx.navigateBack({
      delta:1
    })
  },
  loadDetail(id) {
    var self = this
    app.request({
      url: '/home/hotel/detail',
      method: 'POST',
      data: {
        id: id
      },
      success: (res) => {
        console.log(res)
        self.setData({
          hotel: res.result
        })
        wx.setNavigationBarTitle({
          title: res.result.hotel_name,
        })
      }
    })
  }
})